package com.zznj.xzjc.adapter.index;

import android.view.View;
import android.widget.ImageView;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.zznj.xzjc.R;
import com.zznj.xzjc.bean.index.OrgZdgxBean;
import com.zznj.xzjc.utils.StringUtils;

import java.util.List;

/**
 * 描述：添加类的描述
 *
 * @author wx5e48d604c2885118
 * @time 2020/4/7
 */
public class OrgZdgxAdapter extends BaseQuickAdapter<OrgZdgxBean, BaseViewHolder> {

    public OrgZdgxAdapter(int layoutResId, @Nullable List<OrgZdgxBean> data) {
        super(layoutResId, data);
    }

    private String selectOrgId;
    public void setSelectOrgId(String id){
        this.selectOrgId = id;
        notifyDataSetChanged();
    }

    @Override
    protected void convert(BaseViewHolder helper, OrgZdgxBean item) {
        helper.setText(R.id.title,item.getOrgName());
        helper.setText(R.id.info,"隶属关系："+StringUtils.toStringForWu(item.getOrgPathname()));

        ImageView selectImg = helper.getView(R.id.selectImg);
        if((item.getOrgId()+"").equals(selectOrgId)){
            selectImg.setVisibility(View.VISIBLE);
        }else{
            selectImg.setVisibility(View.GONE);
        }

    }
}
